home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #15 / Monster Media Number 15 (Monster Media)(July 1996).ISO / sound / d4win100.zip / SETUP.MS_ / SETUP.MS
Text File  |  1996-04-05  |  5KB  |  191 lines

  1. '**************************************************************************
  2. '*                   Winman/Portman 4x4/S Setup Script
  3. '**************************************************************************
  4.  
  5. '$DEFINE DEBUG  ''Define for script development/debugging
  6.  
  7. '$INCLUDE 'setupapi.inc'
  8.  
  9. ''Dialog ID's
  10. CONST WELCOME       = 100
  11. CONST ASKQUIT       = 200
  12. CONST DESTPATH      = 300
  13. CONST EXITFAILURE   = 400
  14. CONST EXITQUIT      = 600
  15. CONST EXITSUCCESS   = 700
  16. CONST OPTIONS       = 800
  17. CONST APPHELP       = 900
  18. CONST BADPATH       = 6400
  19.  
  20.  
  21. CONST  LOGO = 1        ''Bitmap ID
  22. GLOBAL DEST$        ''Default destination directory.
  23. GLOBAL WINROOT$     ''Path to Windows root directory.
  24. GLOBAL WINSYSTEM$   ''Path to Windows system directory.
  25.  
  26. DECLARE SUB Install
  27. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  28.  
  29.  
  30. INIT:
  31.     CUIDLL$    = "mscuistf.dll"         ''Custom user interface dll
  32.     HELPPROC$  = "FHelpDlgProc"         ''Help dialog procedure
  33.     DEST$      = "C:\D4WIN"        ''Default destination directory
  34.  
  35.     WINROOT$   = GetWindowsDir()    ''Windows directory
  36.     WINSYSTEM$ = GetWindowsSysDir()      ''Windows system directory
  37.  
  38.     SetBitmap CUIDLL$, LOGO
  39.     SetTitle "D4man Setup"
  40.  
  41.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  42.     IF szInf$ = "" THEN
  43.         szInf$ = GetSymbolValue("STF_CWDDIR") + "SETUP.INF"
  44.     END IF
  45.     ReadInfFile szInf$
  46.  
  47.     OPTCUR$ = "1"  ''delete
  48.  
  49.  
  50. WELCOME:
  51.     sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
  52.     IF sz$ = "CONTINUE" THEN
  53.         UIPop 1
  54.     ELSE
  55.         GOSUB ASKQUIT
  56.         GOTO WELCOME
  57.     END IF
  58.  
  59.  
  60. GETPATH:
  61.     SetSymbolValue "EditTextIn", DEST$
  62.     SetSymbolValue "EditFocus", "END"
  63. GETPATHL1:
  64.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
  65.     DEST$ = GetSymbolValue("EditTextOut")
  66.  
  67.     IF sz$ = "CONTINUE" THEN
  68.         IF IsDirWritable(DEST$) = 0 THEN
  69.             GOSUB BADPATH
  70.             GOTO GETPATHL1
  71.         END IF
  72.         UIPop 1
  73.     ELSE
  74.         GOSUB ASKQUIT
  75.         GOTO GETPATH
  76.     END IF
  77.  
  78.  
  79.     Install
  80.  
  81.  
  82. QUIT:
  83.     ON ERROR GOTO ERRQUIT
  84.  
  85.     IF ERR = 0 THEN
  86.         dlg% = EXITSUCCESS
  87.     ELSEIF ERR = STFQUIT THEN
  88.         dlg% = EXITQUIT
  89.     ELSE
  90.         dlg% = EXITFAILURE
  91.     END IF
  92. QUITL1:
  93.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  94.     IF sz$ = "REACTIVATE" THEN
  95.         GOTO QUITL1
  96.     END IF
  97.     UIPop 1
  98.  
  99.     END
  100.  
  101. ERRQUIT:
  102.     i% = DoMsgBox("Setup sources were corrupted, call technical support!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  103.     END
  104.  
  105.  
  106.  
  107. BADPATH:
  108.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  109.     IF sz$ = "REACTIVATE" THEN
  110.         GOTO BADPATH
  111.     END IF
  112.     UIPop 1
  113.     RETURN
  114.  
  115.  
  116.  
  117. ASKQUIT:
  118.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  119.  
  120.     IF sz$ = "EXIT" THEN
  121.         UIPopAll
  122.         ERROR STFQUIT
  123.     ELSEIF sz$ = "REACTIVATE" THEN
  124.         GOTO ASKQUIT
  125.     ELSE
  126.         UIPop 1
  127.     END IF
  128.     RETURN
  129.  
  130.  
  131.  
  132. '**
  133. '** Purpose:
  134. '**     Builds the copy list and performs all installation operations.
  135. '** Arguments:
  136. '**     none.
  137. '** Returns:
  138. '**     none.
  139. '*************************************************************************
  140. SUB Install STATIC
  141.  
  142.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  143.     CreateDir DEST$, cmoNone
  144.  
  145.     OpenLogFile MakePath(DEST$, "SETUP.LOG"), 0
  146.     WriteToLogFile ""
  147.     WriteToLogFile " User chose as destination directory:  " + DEST$
  148.     WriteToLogFile " May have had to create the directory: " + DEST$
  149.     WriteToLogFile ""
  150.  
  151.     AddSectionFilesToCopyList "AppFiles",       SrcDir$, DEST$
  152.     AddSectionFilesToCopyList "WinRootFiles",   SrcDir$, WINROOT$
  153.     AddSectionFilesToCopyList "WinSystemFiles", SrcDir$, WINSYSTEM$
  154.     CopyFilesInCopyList
  155.  
  156.     WriteToLogFile ""
  157.     WriteToLogFile ";; Creating Group/Item(s) "
  158.     CreateProgmanGroup "D4man for Windows", "", cmoNone
  159.     ShowProgmanGroup   "D4man for Windows", 1, cmoNone
  160.     CreateProgmanItem  "D4man for Windows", "D4man", MakePath(DEST$,"D4win.exe"), "", cmoOverwrite
  161.  
  162.     WriteToLogFile ""
  163.     CloseLogFile
  164.  
  165. END SUB
  166.  
  167.  
  168.  
  169. '**
  170. '** Purpose:
  171. '**     Appends a file name to the end of a directory path,
  172. '**     inserting a backslash character as needed.
  173. '** Arguments:
  174. '**     szDir$  - full directory path (with optional ending "\")
  175. '**     szFile$ - filename to append to directory
  176. '** Returns:
  177. '**     Resulting fully qualified path name.
  178. '*************************************************************************
  179. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  180.     IF szDir$ = "" THEN
  181.         MakePath = szFile$
  182.     ELSEIF szFile$ = "" THEN
  183.         MakePath = szDir$
  184.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  185.         MakePath = szDir$ + szFile$
  186.     ELSE
  187.         MakePath = szDir$ + "\" + szFile$
  188.     END IF
  189. END FUNCTION
  190.  
  191.